package pl.polsl.mmm.projectcomm.objects;

import android.content.Context;

import org.jbox2d.dynamics.World;

import java.util.ArrayList;

/**
 * Created by michal on 10.02.15.
 */
public class PlatformBuldier {

    private ArrayList<Platform> platforms;
    private World world;
    private Context context;

    // x, y, width, height, hidden
    private float[] platformSizes = {
            4f, -5f, 4f, 2f, 0f,
            8f, 10f, 4f, 2f, 0f,
            12f, -2f, 4f, 2f, 0f,
            20f, 12f, 4f, 2f, 1f,
            24f, 24f, 4f, 2f, 0f
    };

    public PlatformBuldier (ArrayList<Platform> platforms, World world, Context context) {
        this.platforms = platforms;
        this.world = world;
        this.context = context;

        // Ziemia
        Platform ground,
                leftWall,
                rightWall;

        ground = new Platform(context, world, 0f, -15f, 300f, 2f, false);
        leftWall = new Platform(context, world, -15f, 0f, 1f, 10f, false);
        rightWall = new Platform(context, world, 135f, 0f, 1f, 10f, false);

        this.setUpPlatforms();
    }

    public void setUpPlatforms() {
        for (int i = 0; i < platformSizes.length / 5; i++) {
            platforms.add(new Platform(context, world,
                    platformSizes[i*5+0],
                    platformSizes[i*5+1],
                    platformSizes[i*5+2],
                    platformSizes[i*5+3],
                    platformSizes[i*5+4]==1f
                    ));
        }
    }
}
